package com.yt.pojo;

import com.fasterxml.jackson.annotation.JsonBackReference;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Data//生成getter setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "Novel",value = "Novel")
@Table(name = "novel")
public class Novel {
    //名称，作者，分类，状态，简介，id(自已用来确认唯一的)
    @ApiModelProperty(value = "小说编号",required = false)
    private Integer nid;
    @ApiModelProperty(value = "小说名",required = false)
    private String novelname;
    @ApiModelProperty(value = "作者编号",required = false)
    private Integer aid;
    @ApiModelProperty(value = "小说类型",required = false)
    private String type;
    @ApiModelProperty(value = "小说状态",required = false)
    private Integer status;
    @ApiModelProperty(value = "小说简介",required = false)
    private String info;
//    @ApiModelProperty(value = "小说作者",required = false)
//    private String author;
    @ApiModelProperty(value = "小说作者",required = false)
    @ManyToOne
    @JoinColumn(name = "aid",referencedColumnName = "id")
    @JsonBackReference
    private Author author;
}
